ae5182c050cf43853d802f3a5bf79a0512a01c31,source/com/intellij/ide/favoritesTreeView/FavoritesTreeViewPanel.java,FavoritesTreeViewPanel,FavoritesTreeViewPanel,#Project#String#,71
Before Change
myTree.setRootVisible(false);
myTree.setShowsRootHandles(true);
myTree.setLargeModel(true);
myTree.setCellRenderer(new NodeRenderer());
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
PopupHandler.installPopupHandler(myTree, (ActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_FAVORITES_VIEW_POPUP),
ActionPlaces.FAVORITES_VIEW_POPUP, ActionManager.getInstance());
After Change
myTree.setRootVisible(false);
myTree.setShowsRootHandles(true);
myTree.setLargeModel(true);
myTree.setCellRenderer(new NodeRenderer() {
public void customizeCellRenderer(JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) {
super.customizeCellRenderer(tree, value, selected, expanded, leaf, row,
hasFocus);
if (value instanceof DefaultMutableTreeNode) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;
//only favorites roots to explain
if (node.getParent() == null || node.getParent().getParent() != null){
return;
}
Object userObject = node.getUserObject();
if (userObject instanceof FavoritesTreeNodeDescriptor) {
final FavoritesTreeNodeDescriptor favoritesTreeNodeDescriptor = ((FavoritesTreeNodeDescriptor)userObject);
AbstractTreeNode treeNode = favoritesTreeNodeDescriptor.getElement();
String locationString = treeNode.getPresentation().getLocationString();
if (locationString != null && locationString.length() > 0) {
append(" (" + locationString + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
} else {
final String location = favoritesTreeNodeDescriptor.getLocation();
if (location != null && location.length() > 0){
append(" (" + location + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
}
}
}
}
});
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree);
PopupHandler.installPopupHandler(myTree, (ActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_FAVORITES_VIEW_POPUP),
ActionPlaces.FAVORITES_VIEW_POPUP, ActionManager.getInstance());